<!DOCTYPE html>
<html>
<head>
  <title>Energia Reference - Reference </title>
  <link rel="shortcut icon" type="image/x-icon" href="http://energia.nu/img/eicon.png">
  <link rel='stylesheet' href='energiaWideRender.css' type='text/css' />
    <!--HeaderText--><style type='text/css'></style>  
  <meta name='robots' content='index,follow' />
  <meta name="Author" content="Robert Wessels" />
  <meta name="Publisher" content="Energia" />
  <meta name="Keywords" content="Energia, Wiring, Processing, Maker, LaunchPad, Arduino, Texas Instruments, Sketch, MSP430, mspgcc, mpsdebug, Electronic Arts, Programming, C, C++, Robert Wessels" />
  <meta name="Description" content="Energia is a rapid prototyping platform for the Texas Instruments MCU Launchpad. Energia is based on Wiring and Arduino and uses the Processing IDE." />
  <meta name="Copyright" content="All contents copyright Robert Wessels" />
  <meta name="Author" content="Robert Wessels" />
  <meta name="Publisher" content="Energia" />
  <meta name="Keywords" content="Energia, Wiring, Processing, Maker, LaunchPad, Arduino, Texas Instruments, Sketch, MSP430, mspgcc, mpsdebug, Electronic Arts, Programming, C, C++, Robert Wessels" />
  <meta name="Description" content="Energia is a rapid prototyping platform for the Texas Instruments MCU Launchpad. Energia is based on Wiring and Arduino and uses the Processing IDE." />
  <meta name="Copyright" content="All contents copyright Robert Wessels" />
</head>
<body>
<div id="page">
  <!--PageHeaderFmt-->
  <div id="pageheader">
    <div class="title"><a href='http://energia.nu'>Energia</a></div>
  </div>
  <!--/PageHeaderFmt-->

  <!--PageLeftFmt-->
  <div id="pagenav">
    <div id="navbar">
  	<p><a class='wikilink' href='http://energia.nu/'>Home</a>
<a class='wikilink' href='http://energia.nu/download'>Download</a>
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
<a class='wikilink' href='index.html'>Reference</a>
<a class="wikilink" href="http://energia.nu/help.html">Getting Help</a>
<a class="nav" href="http://energia.nu/faq.html">FAQ</a>
<a class="wikilink" href="http://energia.nu/projects.html">Projects Using Energia</a>
<a class="nav" href="http://energia.nu/contact.html">Contact Us</a>
</p>


<p class='vspace'></p>

    </div>
  </div>
  <!--/PageLeftFmt-->

  <div id="pagetext">
  <!--PageText-->
<div id='wikitext'>

</p>
<p class='vspace'></p><h1>Language Reference</h1>
<p>Energia programs can be divided in three main parts: <em>structure</em>, <em>values</em> (variables and constants), and <em>functions</em>. 
</p>
<p class='vspace'></p>
<table  width='100%' border='0' cellpadding='5' cellspacing='0'><tr><td  width='33%' valign='top'>
<h2>Structure</h2>
<ul><li><a class='wikilink' href='Setup.html'>setup</a>()
</li><li><a class='wikilink' href='Loop.html'>loop</a>()
</li></ul><p class='vspace'></p><h4>Control Structures</h4>
<ul><li><a class='wikilink' href='If.html'>if</a>
</li><li><a class='wikilink' href='Else.html'>if...else</a>
</li><li><a class='wikilink' href='For.html'>for</a>
</li><li><a class='wikilink' href='SwitchCase.html'>switch case</a>
</li><li><a class='wikilink' href='While.html'>while</a>
</li><li><a class='wikilink' href='DoWhile.html'>do... while</a>
</li><li><a class='wikilink' href='Break.html'>break</a>
</li><li><a class='wikilink' href='Continue.html'>continue</a>
</li><li><a class='wikilink' href='Return.html'>return</a>
</li><li><a class='wikilink' href='Goto.html'>goto</a>
</li></ul><p class='vspace'></p><h4>Further Syntax</h4>
<ul><li><a class='wikilink' href='SemiColon.html'>;</a> (semicolon)
</li><li><a class='wikilink' href='Braces.html'>{}</a> (curly braces)
</li><li><a class='wikilink' href='Comments.html'>//</a> (single line comment)
</li><li><a class='wikilink' href='Comments.html'>/* */</a> (multi-line comment)
</li><li><a class='wikilink' href='Define.html'>#define</a>
</li><li><a class='wikilink' href='Include.html'>#include</a>
</li></ul><p class='vspace'></p><h4>Arithmetic Operators</h4>
<ul><li><a class='wikilink' href='Assignment.html'>=</a> (assignment operator)
</li><li><a class='wikilink' href='Arithmetic.html'>+&nbsp;</a> (addition)
</li><li><a class='wikilink' href='Arithmetic.html'>-</a> (subtraction)
</li><li><a class='wikilink' href='Arithmetic.html'>*</a> (multiplication)
</li><li><a class='wikilink' href='Arithmetic.html'>/</a> (division)
</li><li><a class='wikilink' href='Modulo.html'>%</a> (modulo)
</li></ul><p class='vspace'></p><h4>Comparison Operators</h4>
<ul><li><a class='wikilink' href='If.html'>==</a> (equal to)
</li><li><a class='wikilink' href='If.html'>!=</a> (not equal to)
</li><li><a class='wikilink' href='If.html'>&lt;</a> (less than)
</li><li><a class='wikilink' href='If.html'>&gt;</a> (greater than)
</li><li><a class='wikilink' href='If.html'>&lt;=</a> (less than or equal to)
</li><li><a class='wikilink' href='If.html'>&gt;=</a> (greater than or equal to)
</li></ul><p class='vspace'></p><h4>Boolean Operators</h4>
<ul><li><a class='wikilink' href='Boolean.html'>&amp;&amp;</a> (and)
</li><li><a class='wikilink' href='Boolean.html'>||</a> (or)
</li><li><a class='wikilink' href='Boolean.html'>!</a> (not)
</li></ul><p class='vspace'></p><h4>Pointer Access Operators</h4>
<ul><li><a class='wikilink' href='Pointer.html'>* dereference operator</a>
</li><li><a class='wikilink' href='Pointer.html'>&amp; reference operator</a>
</li></ul><p class='vspace'></p><h4>Bitwise Operators</h4>
<ul><li><a class='wikilink' href='BitwiseAnd.html'>&amp;</a> (bitwise and)
</li><li><a class='wikilink' href='BitwiseAnd.html'>|</a> (bitwise or)
</li><li><a class='wikilink' href='BitwiseAnd.html'>^</a> (bitwise xor)
</li><li><a class='wikilink' href='BitwiseXorNot.html'>~</a> (bitwise not)
</li><li><a class='wikilink' href='Bitshift.html'>&lt;&lt;</a> (bitshift left)
</li><li><a class='wikilink' href='Bitshift.html'>&gt;&gt;</a> (bitshift right)
</li></ul><p class='vspace'></p><h4>Compound Operators</h4>
<ul><li><a class='wikilink' href='Increment.html'>++</a> (increment)
</li><li><a class='wikilink' href='Increment.html'>--</a> (decrement)
</li><li><a class='wikilink' href='IncrementCompound.html'>+=</a> (compound addition)
</li><li><a class='wikilink' href='IncrementCompound.html'>-=</a> (compound subtraction)
</li><li><a class='wikilink' href='IncrementCompound.html'>*=</a> (compound multiplication)
</li><li><a class='wikilink' href='IncrementCompound.html'>/=</a> (compound division)
<p class='vspace'></p></li><li><a class='wikilink' href='BitwiseCompoundAnd.html'>&amp;=</a> (compound bitwise and)
</li><li><a class='wikilink' href='BitwiseCompoundOr.html'>|=</a> (compound bitwise or)
</li></ul><p class='vspace'></p></td><td  width='33%' valign='top'>
<h2>Variables</h2>
<h4>Constants</h4>
<ul><li><a class='wikilink' href='Constants.html'>HIGH</a> | <a class='wikilink' href='Constants.html'>LOW</a>
</li><li><a class='wikilink' href='Constants.html'>INPUT</a> | <a class='wikilink' href='Constants.html'>OUTPUT</a>
</li><li><a class='wikilink' href='Constants.html'>INPUT_PULLUP</a> | <a class='wikilink' href='Constants.html'>INPUT_PULLDOWN</a>
</li><li><a class='wikilink' href='Constants.html'>true</a> | <a class='wikilink' href='Constants.html'>false</a>
</li><li><a class='wikilink' href='IntegerConstants.html'>integer constants</a>
</li><li><a class='wikilink' href='Fpconstants.html'>floating point constants</a>
</li></ul><p class='vspace'></p><h4>Data Types</h4>
<ul><li><a class='wikilink' href='Void.html'>void</a>
</li><li><a class='wikilink' href='BooleanVariables.html'>boolean</a>
</li><li><a class='wikilink' href='Char.html'>char</a>
</li><li><a class='wikilink' href='UnsignedChar.html'>unsigned char</a>
</li><li><a class='wikilink' href='Byte.html'>byte</a>
</li><li><a class='wikilink' href='Int.html'>int</a>
</li><li><a class='wikilink' href='UnsignedInt.html'>unsigned int</a>
</li><li><a class='wikilink' href='Word.html'>word</a>
</li><li><a class='wikilink' href='Long.html'>long</a>
</li><li><a class='wikilink' href='UnsignedLong.html'>unsigned long</a>
</li><li><a class='wikilink' href='Float.html'>float</a>
</li><li><a class='wikilink' href='Double.html'>double</a>
</li><li><a class='wikilink' href='String.html'>string</a> - char array
</li><li><a class='wikilink' href='StringObject.html'>String</a> - object
</li><li><a class='wikilink' href='Array.html'>array</a>
</li></ul><p class='vspace'></p><h4>Conversion</h4>
<ul><li><a class='wikilink' href='CharCast.html'>char()</a>
</li><li><a class='wikilink' href='ByteCast.html'>byte()</a>
</li><li><a class='wikilink' href='IntCast.html'>int()</a>
</li><li><a class='wikilink' href='WordCast.html'>word()</a>
</li><li><a class='wikilink' href='LongCast.html'>long()</a>
</li><li><a class='wikilink' href='FloatCast.html'>float()</a>
</li></ul><p class='vspace'></p><h4>Variable Scope &amp; Qualifiers</h4>
<ul><li><a class='wikilink' href='Scope.html'>variable scope</a>
</li><li><a class='wikilink' href='Static.html'>static</a>
</li><li><a class='wikilink' href='Volatile.html'>volatile</a>
</li><li><a class='wikilink' href='Const.html'>const</a>
</li></ul><p class='vspace'></p><h4>Utilities</h4>
<ul><li><a class='wikilink' href='Sizeof.html'>sizeof</a>()
</li></ul><p class='vspace'></p></td><td  width='33%' valign='top'> 
<p class='vspace'></p><h2>Functions</h2>
<p><h4>Digital I/O</h4>
</p><ul><li><a class='wikilink' href='PinMode.html'>pinMode</a>()   
</li><li><a class='wikilink' href='DigitalWrite.html'>digitalWrite</a>() 
</li><li><a class='wikilink' href='DigitalRead.html'>digitalRead</a>()
</li></ul><p class='vspace'></p><p><h4>Analog I/O</h4>
</p><ul><li><a class='wikilink' href='AnalogReference.html'>analogReference</a>()
</li><li><a class='wikilink' href='AnalogRead.html'>analogRead</a>() 
</li><li><a class='wikilink' href='AnalogWrite.html'>analogWrite</a>() - <em>PWM</em>
</li></ul><p class='vspace'></p><p><h4>Advanced I/O</h4>
</p><ul><li><a class='wikilink' href='Tone.html'>tone</a>()
</li><li><a class='wikilink' href='NoTone.html'>noTone</a>()
</li><li><a class='wikilink' href='ShiftOut.html'>shiftOut</a>() 
</li><li><a class='wikilink' href='ShiftIn.html'>shiftIn</a>() 
</li><li><a class='wikilink' href='PulseIn.html'>pulseIn</a>()
</li></ul><p class='vspace'></p><p><h4>Time</h4>
</p><ul><li><a class='wikilink' href='Millis.html'>millis</a>()   
</li><li><a class='wikilink' href='Micros.html'>micros</a>()   
</li><li><a class='wikilink' href='Delay.html'>delay</a>()  
</li><li><a class='wikilink' href='DelayMicroseconds.html'>delayMicroseconds</a>()
</li></ul><p class='vspace'></p><p><h4>Math</h4>
</p><ul><li><a class='wikilink' href='Min.html'>min</a>()
</li><li><a class='wikilink' href='Max.html'>max</a>()
</li><li><a class='wikilink' href='Abs.html'>abs</a>()
</li><li><a class='wikilink' href='Constrain.html'>constrain</a>()
</li><li><a class='wikilink' href='Map.html'>map</a>()
</li><li><a class='wikilink' href='Pow.html'>pow</a>()
</li><li><a class='wikilink' href='Sqrt.html'>sqrt</a>()
</li></ul><p class='vspace'></p><p><h4>Trigonometry</h4> 
</p><ul><li><a class='wikilink' href='Sin.html'>sin</a>()
</li><li><a class='wikilink' href='Cos.html'>cos</a>()
</li><li><a class='wikilink' href='Tan.html'>tan</a>()
</li></ul><p class='vspace'></p><p><h4>Random Numbers</h4>
</p>
<p class='vspace'></p><ul><li><a class='wikilink' href='RandomSeed.html'>randomSeed</a>()
</li><li><a class='wikilink' href='Random.html'>random</a>()
</li></ul><p class='vspace'></p><p><h4>Bits and Bytes</h4>
</p><ul><li><a class='wikilink' href='LowByte.html'>lowByte</a>()
</li><li><a class='wikilink' href='HighByte.html'>highByte</a>()
</li><li><a class='wikilink' href='BitRead.html'>bitRead</a>()
</li><li><a class='wikilink' href='BitWrite.html'>bitWrite</a>()
</li><li><a class='wikilink' href='BitSet.html'>bitSet</a>()
</li><li><a class='wikilink' href='BitClear.html'>bitClear</a>()
</li><li><a class='wikilink' href='Bit.html'>bit</a>()
</li></ul><p class='vspace'></p><p><h4>External Interrupts</h4>
</p>
<p class='vspace'></p><ul><li><a class='wikilink' href='AttachInterrupt.html'>attachInterrupt</a>()
</li><li><a class='wikilink' href='DetachInterrupt.html'>detachInterrupt</a>()
</li></ul><p class='vspace'></p><p><h4>Interrupts</h4>
</p>
<p class='vspace'></p><ul><li><a class='wikilink' href='Interrupts.html'>interrupts</a>()
</li><li><a class='wikilink' href='NoInterrupts.html'>noInterrupts</a>()
</li></ul><p class='vspace'></p><p><h4>Communication</h4>
</p>
<p class='vspace'></p><ul><li><a class='wikilink' href='Serial.html'>Serial</a>
</li><li><a class='wikilink' href='Stream.html'>Stream</a></td></tr></table>
<p class='vspace'></p><p><h4>Looking for something else?</h4>  See the <a class='wikilink' href='Libraries.html'>libraries page</a> for interfacing with particular types of hardware.  Try the list of community-contributed code on the <a class='urllink' href='http://forum.43oh.com/forum/28-energia/' rel='nofollow'>Forum</a>.   The Energia language is based on C/C++ and uses the MSPGCC compiler.
</p>
<p class='vspace'></p>
<p><a class='selflink' href='index.html'>Reference Home</a>
</p>
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://forum.43oh.com/forum/28-energia/' rel='nofollow'>Forum</a>.</em>
</p>
<p class='vspace'></p><p>The text of the Energia Reference is licensed under a
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>.  Energia reference is based on Arduino reference.  Code samples in the reference are released into the public domain.
</p>
</div>


  </div>

  <!--PageFooterFmt-->
  <div id="pagefooter">
&copy; Energia | 
  <a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='#'>All Recent Site Changes</a>
  </div>
  <!--/PageFooterFmt-->

</div>
</body>
</html>
